package com.acwing.partition9;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

/**
 * @author `RKC`
 * @date 2021/12/4 10:16
 */
public class AC869试除法求约数 {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] s = reader.readLine().split(" ");
        int n = Integer.parseInt(s[0]);
        while (n-- > 0) {
            int x = Integer.parseInt(reader.readLine().split(" ")[0]);
            List<Integer> divisor = divisor(x);
            for (Integer item : divisor) {
                writer.write(item + " ");
            }
            writer.write("\n");
        }
        writer.flush();
    }

    private static List<Integer> divisor(int x) {
        List<Integer> answer = new ArrayList<>();
        for (int i = 1; i <= x / i; i++) {
            if (x % i == 0) {
                //i * y = x，约数都是成对出现的
                answer.add(i);
                if (i != x / i) answer.add(x / i);
            }
        }
        answer.sort(Integer::compare);
        return answer;
    }
}
